async function sys_menuFn(diy_table) {
  // 现在要把diy_menu和diy_field也迁移过去
  let sql = `SELECT * FROM \`sys_menu\` WHERE DiyTableId = '${diy_table.Id}'`;
  const [sourceMenus] = await sourceConn.query(sql);
  if (sourceMenus.length === 0) {
    res.status(404).json({ success: false, message: `表 ${tableName} 在源数据库中没有菜单` });
    return;
  }
  const sourceMenu = sourceMenus[0];
  sql = `SELECT * FROM \`sys_menu\` WHERE DiyTableId = '${diy_table.Id}'`;
  const [targetMenus] = await targetConn.query(sql);
  if (targetMenus.length > 0) {
    // res.status(400).json({ success: false, message: `表 ${tableName} 的菜单已存在于目标数据库中` });
    return targetMenus[0];
  } else {
    // 所有字段迁移
    const menuFields = Object.keys(sourceMenu);
    const menuPlaceholders = menuFields.map(() => "?").join(", ");
    const menuValues = menuFields.map((f) => sourceMenu[f]);
    const escapedMenuFields = menuFields.map((f) => `\`${f}\``).join(", ");
    sql = `INSERT INTO sys_menu (${escapedMenuFields}) VALUES (${menuPlaceholders})`;
    let res = await targetConn.query(sql, menuValues);
    return res;
  }
}
// 添加菜单
var menuResult = await sys_menuFn(diy_table);
